package com.huaxin.feignclient.fluoritecloud;

import com.huaxin.feignclient.fluoritecloud.models.FluoriteGetTokenResponse;
import com.huaxin.feignclient.fluoritecloud.models.FluoriteLiveUrlResponse;
import com.huaxin.feignclient.fluoritecloud.models.FluoriteResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Component
@FeignClient(name = "fluoriteCloud-client", url = "https://open.ys7.com")
public interface FluoriteCloudClient {
    // 获取 token
    @PostMapping(
            value = "/api/lapp/token/get",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE
    )
    FluoriteResponse<FluoriteGetTokenResponse> getToken(@RequestBody Map<String, String> params);

    // 获取直播地址
    @PostMapping(
            value = "/api/lapp/v2/live/address/get",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE
    )
    FluoriteResponse<FluoriteLiveUrlResponse> getLiveUrl(@RequestBody Map<String, String> params);
}
